# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-openapi-spec-validator
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=openapi-spec-validator
pkgver=0.7.1
pkgrel=0
pkgdesc="OpenAPI 2.0 (aka Swagger) and OpenAPI 3 spec validator"
url="https://github.com/python-openapi/openapi-spec-validator"
arch="noarch"
license="Apache-2.0"
depends="
	py3-jsonschema
	py3-jsonschema-path
	py3-openapi-schema-validator
	py3-lazy-object-proxy
"
checkdepends="
	py3-pytest
	py3-pytest-cov
"
makedepends="
	poetry
	py3-setuptools
	py3-gpep517
	py3-wheel
"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-openapi/openapi-spec-validator/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer "$builddir"/.dist/*.whl
	.testenv/bin/python3 -m pytest -v
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
2a57ae1beb5f38f278839749f80cd92881bb57aa035573e604ee5fad5db6868150a9b4ebd1c00c20cc0fa00672619f5d99295de4df3173d25a841fe25c374c9d  py3-openapi-spec-validator-0.7.1.tar.gz
"
